﻿using UnityEngine;
using System.Collections;
[ExecuteInEditMode]

public class MainMenu : MonoBehaviour
{
    public GUISkin racingGUISkin;
    public Vector2 buttonStartLocation;
    public Vector2 buttonExitLocation;
    public _GUIClasses.Location center = new _GUIClasses.Location();

    // Update is called once per frame
    void Update()
    {
        center.updateLocation();
    }

    void OnGUI()
    {
        GUI.skin = racingGUISkin;
        GUI.depth = -1;
        GUI.backgroundColor = Color.cyan;

        Rect startButtonRectangle = new Rect(center.offset.x + buttonStartLocation.x, center.offset.y + buttonStartLocation.y, 250, 50);
        bool enterIsPressed = (Input.GetKeyDown("return") == true) || (Input.GetKey(KeyCode.KeypadEnter));

        if (GUI.Button(startButtonRectangle, "START") || enterIsPressed)
        {
            Application.LoadLevel("GameScene");
        }

        if (GUI.Button(new Rect(center.offset.x + buttonExitLocation.x, center.offset.y + buttonExitLocation.y, 250, 50), "EXIT"))
        {
            Application.Quit();
        }
    }

}

